package tank.cor;

import tank.Bullet;
import tank.Explode;
import tank.GameObject;
import tank.Tank;
import tank.Wall;

public class BulletWallCollider implements Collider {

	@Override
	public boolean collide(GameObject o1, GameObject o2) {
		if(o1 instanceof Tank && o2 instanceof Wall) {
			Tank tank = (Tank)o1;
			Wall wall = (Wall)o2;
			if(tank.getRect().intersects(wall.getRect())) {
				tank.setX(tank.getPreX());
				tank.setY(tank.getPreY());
			}
		}else if(o2 instanceof Tank && o1 instanceof Wall){
			return collide(o2, o1);
		}
		return false;
	}

}
